#include <stdio.h>
#include <string.h>

int hammingDistance(char *str1, char *str2, int len)
{
    int distance = 0;
    for (int i = 0; i < len; i++)
    {
        if (str1[i] != str2[i])
        {
            distance++;
        }
    }
    return distance;
}

void findTargetString(char *str1, char *str2, int len)
{

    int n = 0;
    int sum1 = 0;
    int sum2 = 0;
    int sum3 = 0;
    int j = len - 1;

    char target[len + 1];
    for (int i = 0; i < len; i++)
    {
        target[i] = 'a';

        if (str1[i] == 'a')
            sum1++;
        if (str2[i] == 'a')
            sum2++;
        if (str1[i] == 'a' && str2[i] == 'a')
        {
            sum3++;
        }
    }
    for (int i = 0; i < len; i++)
    {
    }
    if (sum1 > sum2)
    {
        while (sum1 != sum2)
        {
            if (sum1 - sum2 == 1)
            {
                if (str1[j] != 'a' && str2[j] != 'a')
                {
                    target[j] = str2[j];
                    sum2++;
                }
                j--;
                continue;
            }
            else if (sum1 - sum2 >= 2)
            {
                if (str1[j] == 'a' && str2[j] != 'a')
                {
                    target[j] = str2[j];
                    sum1--;
                    sum2++;
                }
                else if (str1[j] != 'a' && str2[j] != 'a')
                {
                    target[j] = str2[j];
                    sum2++;
                }
                j--;
                continue;
            }
        }
    }
    else if (sum1 < sum2)
    {
        while (sum1 != sum2)
        {
            if (sum2 - sum1 == 1)
            {
                if (str2[j] != 'a' && str1[j] != 'a')
                {
                    target[j] = str1[j];
                    sum1++;
                }
                j--;
                continue;
            }
            else if (sum2 - sum1 >= 2)
            {
                if (str1[j] == 'a' && str2[j] != 'a')
                {
                    target[j] = str1[j];
                    sum2--;
                    sum1++;
                }
                j--;
                continue;
            }
        }
    }

    target[len] = '\0';
    printf("%s\n", target);
}

int main()
{
    int T;
    scanf("%d", &T);

    for (int t = 1; t <= T; t++)
    {
        int len;
        char str1[100001], str2[100001];
        scanf("%s", str1);
        scanf("%s", str2);
        len = strlen(str1);

        printf("Case %d: ", t);
        findTargetString(str1, str2, len);
    }

    return 0;
}